# include "Transformation.h"

namespace WuguiEngine
{
	namespace Graphics
	{
		Transformation::Transformation()
		{
			scale = D3DXVECTOR3(1.0f, 1.0f, 1.0f);
			pRotation = new D3DXQUATERNION();
			D3DXQuaternionIdentity(pRotation);
			position = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
		}

		Transformation::Transformation(D3DXVECTOR3 _scale, 
			D3DXQUATERNION* _rotation, D3DXVECTOR3 _position)
		{
			scale = _scale;
			pRotation = _rotation;
			position = _position;
		}

		D3DXVECTOR3 Transformation::GetScale()
		{
			return scale;
		}	

		D3DXQUATERNION* Transformation::GetRotation()
		{
			return pRotation;
		}

		D3DXVECTOR3 Transformation::GetPosition()
		{
			return position;
		}

		void Transformation::SetPosition(D3DXVECTOR3 pos)
		{
			position = pos;
		}

		void Transformation::SetRotation(D3DXQUATERNION* qua)
		{
			pRotation = qua;
		}

		void Transformation::SetScale(D3DXVECTOR3 vec)
		{
			scale = vec;
		}

		D3DXMATRIX* Transformation::GetTransformationMatrix()
		{
			D3DXMATRIX* pMat = new D3DXMATRIX();
			D3DXMatrixTransformation(pMat,
				NULL,
				NULL,
				&scale,
				NULL,
				pRotation,
				&position);
			return pMat;
		}
	}
}